package cn.demo.pm.service.impl;

import java.util.List;
import com.mybatisflex.core.paginate.Page;
import cn.demo.common.core.page.PageQuery;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import cn.demo.pm.mapper.PmStoreGoodsMapper;
import cn.demo.pm.domain.PmStoreGoods;
import cn.demo.pm.service.IPmStoreGoodsService;

/**
 * 积分商城产品Service业务层处理
 *
 * @author xtjun
 * @date 2024-06-06
 */
@Service
public class PmStoreGoodsServiceImpl extends ServiceImpl<PmStoreGoodsMapper, PmStoreGoods> implements IPmStoreGoodsService {
    @Resource
    private PmStoreGoodsMapper pmStoreGoodsMapper;
    /**
     * 查询积分商城产品
     *
     * @param id 积分商城产品主键
     * @return 积分商城产品
     */
    @Override
    public PmStoreGoods selectPmStoreGoodsById(String id) {
        return pmStoreGoodsMapper.selectOneById(id);
    }

    /**
     * 查询积分商城产品列表
     *
     * @param pmStoreGoods 积分商城产品
     * @return 积分商城产品
     */
    @Override
    public Page<PmStoreGoods> selectPmStoreGoodsPage(PmStoreGoods pmStoreGoods, PageQuery pageQuery) {
        return pmStoreGoodsMapper.paginate(pageQuery.build(), QueryWrapper.create(pmStoreGoods,PmStoreGoods.operators));
    }
    @Override
    public List<PmStoreGoods> selectPmStoreGoodsList(PmStoreGoods pmStoreGoods) {
        return pmStoreGoodsMapper.selectListByQuery(QueryWrapper.create(pmStoreGoods,PmStoreGoods.operators));
    }

    /**
     * 新增积分商城产品
     *
     * @param pmStoreGoods 积分商城产品
     * @return 结果
     */
    @Override
    public int insertPmStoreGoods(PmStoreGoods pmStoreGoods) {
        return pmStoreGoodsMapper.insert(pmStoreGoods);
    }

    /**
     * 修改积分商城产品
     *
     * @param pmStoreGoods 积分商城产品
     * @return 结果
     */
    @Override
    public int updatePmStoreGoods(PmStoreGoods pmStoreGoods) {
        return pmStoreGoodsMapper.update(pmStoreGoods);
    }

    /**
     * 批量删除积分商城产品
     *
     * @param ids 需要删除的积分商城产品主键
     * @return 结果
     */
    @Override
    public int deletePmStoreGoodsByIds(List<String> ids) {
        return pmStoreGoodsMapper.deleteBatchByIds(ids);
    }

    /**
     * 删除积分商城产品信息
     *
     * @param id 积分商城产品主键
     * @return 结果
     */
    @Override
    public int deletePmStoreGoodsById(String id) {
        return pmStoreGoodsMapper.deleteById(id);
    }
}
